package org.jbit.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

import org.jbit.dao.BaseDao;
import org.jbit.vo.GPSInfoVo;

public class GPSInfoDao
{
	private Connection conn;
	private PreparedStatement ps;
	private ResultSet rs;
	
	
	public String TimeChange(String TimeO) {
		/*
		 * 20080808080808->2008-08-08 08:08:08
		 */
		String TimeC = "2008-08-08;08:08:08";
		TimeC = TimeO.substring(0, 4) + "-" + TimeO.substring(4, 6) + "-"
				+ TimeO.substring(6, 8) + " "
				+ ((Integer.parseInt(TimeO.substring(8, 10)) + 8) % 24) + ":"
				+ TimeO.substring(10, 12) + ":" + TimeO.substring(12, 14);
		return TimeC;
	}
 
	public String LatitudeChange(String LatitudeO) {
		/*
		 * 3955.79916->39.929986
		 */
		String LatitudeC = "39.929986";
		float LatitudeD=Float.parseFloat(LatitudeO);
		String LatitudeDd=""+(int)LatitudeD/100;
		String LatitudeMn=""+((LatitudeD/100-(int)LatitudeD/100)*100);
		String LatitudeMToD=""+String.format("%.6f",Double.parseDouble(LatitudeMn)/60);
		LatitudeC=LatitudeDd+LatitudeMToD.substring(1, LatitudeMToD.length());
		return LatitudeC;
	}
	
	public String LongitudeChange(String LongitudeO) {
		/*
		 * 11623.7387->116.395645
		 */
		String LongitudeC = "116.395645";
		float LongitudeD=Float.parseFloat(LongitudeO);
		String LongitudeDd=""+(int)LongitudeD/100;
		String LongitudeMm=""+((LongitudeD/100-(int)LongitudeD/100)*100);
		String LongitudeMToD=""+String.format("%.6f",Double.parseDouble(LongitudeMm)/60);
		LongitudeC=LongitudeDd+LongitudeMToD.substring(1, LongitudeMToD.length());
		return LongitudeC;
	}
	
	
	
	public String getCarStatues(String ModuleMark)
	{
		/*
		 * select * from(
select *,ROW_NUMBER() OVER(Order by city DESC) rs  from mailCode) b
where b.rs BETWEEN 1 and 5
		 * 
		 * */
		String Statues="0";
		String sql=null;
		sql="SELECT Statue  FROM Statues where ModuleMark=?";	
try {
			
			conn = BaseDao.getConnection();
			ps = conn.prepareStatement(sql);
			ps.setString(1, ModuleMark);
			rs = ps.executeQuery();
			
			while (rs.next()) 
				Statues=rs.getString("Statue");
				
		}
		catch (Exception e) {
			e.printStackTrace();
		}

		
		finally {
			BaseDao.closeAll(rs, ps, conn);
		}
				
		return Statues;
	}
	
	
	public boolean StartCar(String moduleMark) {
		// TODO Auto-generated method stub
		boolean flg=false;
		String sql = "update  Statues set Statue='1' where ModuleMark=?";
	
		try {			
			conn = BaseDao.getConnection();
			ps = conn.prepareStatement(sql);
			ps.setString(1,moduleMark);
			int i = ps.executeUpdate();

			if (i > 0) {
				flg = true;
			}
			      conn.close();
		}

		catch (Exception e) {
			e.printStackTrace();
		}

		finally {
			BaseDao.closeAll(rs, ps, conn);
		}
		return flg;
	}
	public boolean EndCar(String moduleMark) {
		// TODO Auto-generated method stub
		boolean flg=false;
		String sql = "update  Statues set Statue='2' where ModuleMark=?";
	
		try {			
			conn = BaseDao.getConnection();
			ps = conn.prepareStatement(sql);
			ps.setString(1,moduleMark);
			int i = ps.executeUpdate();

			if (i > 0) {
				flg = true;
			}
			      conn.close();
		}

		catch (Exception e) {
			e.printStackTrace();
		}

		finally {
			BaseDao.closeAll(rs, ps, conn);
		}
		return flg;
	}
	
	
	public GPSInfoVo getGPSInfoShow(String ModuleMark)
	{
		/*
		 * select * from(
select *,ROW_NUMBER() OVER(Order by city DESC) rs  from mailCode) b
where b.rs BETWEEN 1 and 5
		 * 
		 * */
		GPSInfoVo Info=new GPSInfoVo();
		String sql=null;
		sql="select a.ModuleMark,a.Information,c.realName,"
			+"c.userMobile,c.ModuleMobile,b.Statue,c.carId,"
			+"c.regitTime,e.name province,f.name city,d.name county "
			+"from GPRSInfo a,Statues b,userInfo c,D_county d,D_province e,D_city f where "
			+"a.ModuleMark  =b.ModuleMark and a.ModuleMark=c.ModuleMark "
			+"and  c.countyId=d.id and d.cityId=f.id and f.provinId "
			+"=e.id and a.ModuleMark=?";	
try {
			
			conn = BaseDao.getConnection();
			ps = conn.prepareStatement(sql);
			ps.setString(1, ModuleMark);
			rs = ps.executeQuery();
			
			while (rs.next()) {		
				
				Info.setModuleMark(rs.getString("ModuleMark").trim());
				String Information=rs.getString("Information").trim();
				String Infor[]=Information.split(",");
				Info.setUTCTime(TimeChange(Infor[1]));
				Info.setLatitude(LatitudeChange(Infor[2]));
				Info.setLatitudeHemisphere(Infor[3]);
				Info.setLongitude(LongitudeChange(Infor[4]));
				Info.setLongitudeHemisphere(Infor[5]);
				Info.setGPSStatue(Infor[6]);
				Info.setSatellite_Number(Infor[7]);
				Info.setStatus(rs.getString("Statue"));
				Info.setCounty(rs.getString("province").trim()+rs.getString("city").trim()+rs.getString("county").trim());
				Info.setRealName(rs.getString("realName").trim());
				Info.setModulePhone(rs.getString("ModuleMobile").trim());
				Info.setUserPhone(rs.getString("userMobile").trim());
				Info.setRegitTime(rs.getString("regitTime").trim());
				Info.setCarId(rs.getString("carId").trim());
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}

		
		finally {
			BaseDao.closeAll(rs, ps, conn);
		}
				
		return Info;
	}
	
	public List<GPSInfoVo> getGPSInfoListShow(String ModuleMark)
	{
		List<GPSInfoVo> list=new ArrayList<GPSInfoVo>();
		
		String sql=null;
		sql="select a.ModuleMark,a.Information,c.realName,"
			+"c.userMobile,c.ModuleMobile,b.Statue,c.carId,"
			+"c.regitTime,e.name province,f.name city,d.name county "
			+"from GPRSInfoList a,Statues b,userInfo c,D_county d,D_province e,D_city f where "
			+"a.ModuleMark  =b.ModuleMark and a.ModuleMark=c.ModuleMark "
			+"and  c.countyId=d.id and d.cityId=f.id and f.provinId "
			+"=e.id and a.ModuleMark=?";	
try {
			
			conn = BaseDao.getConnection();
			ps = conn.prepareStatement(sql);
			ps.setString(1, ModuleMark);
			rs = ps.executeQuery();
			
			while (rs.next()) {		
				GPSInfoVo Info=new GPSInfoVo();
				Info.setModuleMark(rs.getString("ModuleMark").trim());
				String Information=rs.getString("Information").trim();
				String Infor[]=Information.split(",");
				Info.setUTCTime(TimeChange(Infor[1]));
				Info.setLatitude(LatitudeChange(Infor[2]));
				Info.setLatitudeHemisphere(Infor[3]);
				Info.setLongitude(LongitudeChange(Infor[4]));
				Info.setLongitudeHemisphere(Infor[5]);
				Info.setGPSStatue(Infor[6]);
				Info.setSatellite_Number(Infor[7]);
				Info.setStatus(rs.getString("Statue"));
				Info.setCounty(rs.getString("province").trim()+rs.getString("city").trim()+rs.getString("county").trim());
				Info.setRealName(rs.getString("realName").trim());
				Info.setModulePhone(rs.getString("ModuleMobile").trim());
				Info.setUserPhone(rs.getString("userMobile").trim());
				Info.setRegitTime(rs.getString("regitTime").trim());
				Info.setCarId(rs.getString("carId").trim());
				list.add(Info);
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}

		
		finally {
			BaseDao.closeAll(rs, ps, conn);
		}
				
		return list;
	}
	
	public List<GPSInfoVo> getGPSInfoShow(String ModuleMark,String rows,String page)
	{
		/*
		 * select * from(
select *,ROW_NUMBER() OVER(Order by city DESC) rs  from mailCode) b
where b.rs BETWEEN 1 and 5
		 * 
		 * */
		List<GPSInfoVo> list=new ArrayList<GPSInfoVo>();
		int rowsInt = Integer.valueOf(rows);
		int pageInt = Integer.valueOf(page);
		String sql=null;
		
		
		sql="select * from"
			+"(select a.ModuleMark,a.Information,c.realName,"
			+"c.userMobile,c.ModuleMobile,b.Statue,c.carId,"
			+"c.regitTime,e.name province,f.name city,d.name county,ROW_NUMBER() OVER(Order by a.ModuleMark DESC) rs "
			+"from GPRSInfo a,Statues b,userInfo c,D_county d,D_province e,D_city f where "
			+"a.ModuleMark  =b.ModuleMark and a.ModuleMark=c.ModuleMark "
			+"and  c.countyId=d.id and d.cityId=f.id and f.provinId"
			+"=e.id and a.ModuleMark=? )r where r.rs  BETWEEN ? and ?";
		
try {
			
			conn = BaseDao.getConnection();
			ps = conn.prepareStatement(sql);
			ps.setString(1, ModuleMark);
			ps.setInt(2, +((pageInt - 1) * rowsInt + 1));
			ps.setInt(3, pageInt * rowsInt);
			rs = ps.executeQuery();
			
			while (rs.next()) {
		
				GPSInfoVo Info=new GPSInfoVo();
				Info.setModuleMark(rs.getString("ModuleMark").trim());
				String Information=rs.getString("Information").trim();
				String Infor[]=Information.split(",");
				Info.setUTCTime(TimeChange(Infor[1]));
				Info.setLatitude(LatitudeChange(Infor[2]));
				Info.setLatitudeHemisphere(Infor[3]);
				Info.setLongitude(LongitudeChange(Infor[4]));
				Info.setLongitudeHemisphere(Infor[5]);
				Info.setGPSStatue(Infor[6]);
				Info.setSatellite_Number(Infor[7]);
				Info.setStatus(rs.getString("Statue"));
				Info.setCounty(rs.getString("province").trim()+rs.getString("city").trim()+rs.getString("county").trim());
				Info.setRealName(rs.getString("realName").trim());
				Info.setModulePhone(rs.getString("ModuleMobile").trim());
				Info.setUserPhone(rs.getString("userMobile").trim());
				Info.setRegitTime(rs.getString("regitTime").trim());
				Info.setCarId(rs.getString("carId").trim());
				list.add(Info);
			}
		}

		
		catch (Exception e) {
			e.printStackTrace();
		}

		
		finally {
			BaseDao.closeAll(rs, ps, conn);
		}
				
		return list;
	}
	
	

	
	public String getGPSInfoShowTotal(String ModuleMark)
	{
		/*
		 * select * from(
select *,ROW_NUMBER() OVER(Order by city DESC) rs  from mailCode) b
where b.rs BETWEEN 1 and 5
		 * 
		 * */
		String number="0";
		String sql=null;
		sql="select count(*) number "
			+"from GPRSInfo,Statues,userInfo,D_county,D_province,D_city where "
			+"GPRSInfo.ModuleMark  =Statues.ModuleMark and GPRSInfo.ModuleMark=userInfo.ModuleMark "
			+"and  userInfo.countyId=D_county.id and D_county.cityId=D_city.id and D_city.provinId "
			+"=D_province.id and GPRSInfo.ModuleMark=?";	
try {
			
			conn = BaseDao.getConnection();
			ps = conn.prepareStatement(sql);
			ps.setString(1, ModuleMark);
			rs = ps.executeQuery();
			
			while (rs.next()) 
				number=rs.getString("number");
				
		}

		
		catch (Exception e) {
			e.printStackTrace();
		}

		
		finally {
			BaseDao.closeAll(rs, ps, conn);
		}
				
		return number;
	}

	public List<GPSInfoVo> getGPSInfoList(String rows,String page)
	{
		/*
		 * select * from(
select *,ROW_NUMBER() OVER(Order by city DESC) rs  from mailCode) b
where b.rs BETWEEN 1 and 5
		 * 
		 * */
		List<GPSInfoVo> list=new ArrayList<GPSInfoVo>();
		int rowsInt = Integer.valueOf(rows);
		int pageInt = Integer.valueOf(page);
		String sql=null;
		
		
		sql="select * from"
			+"(select a.ModuleMark,a.Information,c.realName,"
			+"c.userMobile,c.ModuleMobile,b.Statue,c.carId,"
			+"c.regitTime,e.name province,f.name city,d.name county,ROW_NUMBER() OVER(Order by a.ModuleMark DESC) rs "
			+"from GPRSInfo a,Statues b,userInfo c,D_county d,D_province e,D_city f where "
			+"a.ModuleMark  =b.ModuleMark and a.ModuleMark=c.ModuleMark "
			+"and  c.countyId=d.id and d.cityId=f.id and f.provinId"
			+"=e.id )r where r.rs  BETWEEN ? and ?";
		
try {
			
			conn = BaseDao.getConnection();
			ps = conn.prepareStatement(sql);
			ps.setInt(1, +((pageInt - 1) * rowsInt + 1));
			ps.setInt(2, pageInt * rowsInt);
			rs = ps.executeQuery();
			
			while (rs.next()) {
		
				GPSInfoVo Info=new GPSInfoVo();
				Info.setModuleMark(rs.getString("ModuleMark").trim());
				String Information=rs.getString("Information").trim();
				String Infor[]=Information.split(",");
				Info.setUTCTime(TimeChange(Infor[1]));
				Info.setLatitude(LatitudeChange(Infor[2]));
				Info.setLatitudeHemisphere(Infor[3]);
				Info.setLongitude(LongitudeChange(Infor[4]));
				Info.setLongitudeHemisphere(Infor[5]);
				Info.setGPSStatue(Infor[6]);
				Info.setSatellite_Number(Infor[7]);
				Info.setStatus(rs.getString("Statue"));
				Info.setCounty(rs.getString("province").trim()+rs.getString("city").trim()+rs.getString("county").trim());
				Info.setRealName(rs.getString("realName").trim());
				Info.setModulePhone(rs.getString("ModuleMobile").trim());
				Info.setUserPhone(rs.getString("userMobile").trim());
				Info.setRegitTime(rs.getString("regitTime").trim());
				Info.setCarId(rs.getString("carId").trim());
				list.add(Info);
			}
		}

		
		catch (Exception e) {
			e.printStackTrace();
		}

		
		finally {
			BaseDao.closeAll(rs, ps, conn);
		}
				
		return list;
	}
	
	

	
	public String getGPSInfoListTotal()
	{
		/*
		 * select * from(
select *,ROW_NUMBER() OVER(Order by city DESC) rs  from mailCode) b
where b.rs BETWEEN 1 and 5
		 * 
		 * */
		String number="0";
		String sql=null;
		sql="select count(*) number "
			+"from GPRSInfo,Statues,userInfo,D_county,D_province,D_city where "
			+"GPRSInfo.ModuleMark  =Statues.ModuleMark and GPRSInfo.ModuleMark=userInfo.ModuleMark "
			+"and  userInfo.countyId=D_county.id and D_county.cityId=D_city.id and D_city.provinId "
			+"=D_province.id";	
try {
			
			conn = BaseDao.getConnection();
			ps = conn.prepareStatement(sql);
			rs = ps.executeQuery();
			
			while (rs.next()) 
				number=rs.getString("number");
				
		}

		
		catch (Exception e) {
			e.printStackTrace();
		}

		
		finally {
			BaseDao.closeAll(rs, ps, conn);
		}
				
		return number;
	}	
	public List<GPSInfoVo> getGPSInfoDetailList(String rows,String page)
	{
		/*
		 * select * from(
select *,ROW_NUMBER() OVER(Order by city DESC) rs  from mailCode) b
where b.rs BETWEEN 1 and 5
		 * 
		 * */
		List<GPSInfoVo> list=new ArrayList<GPSInfoVo>();
		int rowsInt = Integer.valueOf(rows);
		int pageInt = Integer.valueOf(page);
		String sql=null;
		
		
		sql="select * from"
			+"(select a.ModuleMark,a.Information,c.realName,"
			+"c.userMobile,c.ModuleMobile,b.Statue,c.carId,"
			+"c.regitTime,e.name province,f.name city,d.name county,ROW_NUMBER() OVER(Order by a.ModuleMark DESC) rs "
			+"from GPRSInfoList a,Statues b,userInfo c,D_county d,D_province e,D_city f where "
			+"a.ModuleMark  =b.ModuleMark and a.ModuleMark=c.ModuleMark "
			+"and  c.countyId=d.id and d.cityId=f.id and f.provinId"
			+"=e.id )r where r.rs  BETWEEN ? and ?";
		
try {
			
			conn = BaseDao.getConnection();
			ps = conn.prepareStatement(sql);
			ps.setInt(1, +((pageInt - 1) * rowsInt + 1));
			ps.setInt(2, pageInt * rowsInt);
			rs = ps.executeQuery();
			
			while (rs.next()) {
		
				GPSInfoVo Info=new GPSInfoVo();
				Info.setModuleMark(rs.getString("ModuleMark").trim());
				String Information=rs.getString("Information").trim();
				String Infor[]=Information.split(",");
				Info.setUTCTime(TimeChange(Infor[1]));
				Info.setLatitude(LatitudeChange(Infor[2]));
				Info.setLatitudeHemisphere(Infor[3]);
				Info.setLongitude(LongitudeChange(Infor[4]));
				Info.setLongitudeHemisphere(Infor[5]);
				Info.setGPSStatue(Infor[6]);
				Info.setSatellite_Number(Infor[7]);
				Info.setStatus(rs.getString("Statue"));
				Info.setCounty(rs.getString("province").trim()+rs.getString("city").trim()+rs.getString("county").trim());
				Info.setRealName(rs.getString("realName").trim());
				Info.setModulePhone(rs.getString("ModuleMobile").trim());
				Info.setUserPhone(rs.getString("userMobile").trim());
				Info.setRegitTime(rs.getString("regitTime").trim());
				Info.setCarId(rs.getString("carId").trim());
				list.add(Info);
			}
		}

		
		catch (Exception e) {
			e.printStackTrace();
		}

		
		finally {
			BaseDao.closeAll(rs, ps, conn);
		}
				
		return list;
	}
	
	

	
	public String getGPSInfoDetailListTotal()
	{
		/*
		 * select * from(
select *,ROW_NUMBER() OVER(Order by city DESC) rs  from mailCode) b
where b.rs BETWEEN 1 and 5
		 * 
		 * */
		String number="0";
		String sql=null;
		sql="select count(*) number "
			+"from GPRSInfoList,Statues,userInfo,D_county,D_province,D_city where "
			+"GPRSInfoList.ModuleMark  =Statues.ModuleMark and GPRSInfoList.ModuleMark=userInfo.ModuleMark "
			+"and  userInfo.countyId=D_county.id and D_county.cityId=D_city.id and D_city.provinId "
			+"=D_province.id";	
try {
			
			conn = BaseDao.getConnection();
			ps = conn.prepareStatement(sql);
			rs = ps.executeQuery();
			
			while (rs.next()) 
				number=rs.getString("number");
				
		}

		
		catch (Exception e) {
			e.printStackTrace();
		}

		
		finally {
			BaseDao.closeAll(rs, ps, conn);
		}
				
		return number;
	}	
	
	public List<GPSInfoVo> getGPSInfoDetailList(String rows,String page,String ModuleMark)
	{
		/*
		 * select * from(
select *,ROW_NUMBER() OVER(Order by city DESC) rs  from mailCode) b
where b.rs BETWEEN 1 and 5
		 * 
		 * */
		List<GPSInfoVo> list=new ArrayList<GPSInfoVo>();
		int rowsInt = Integer.valueOf(rows);
		int pageInt = Integer.valueOf(page);
		String sql=null;
		
		
		sql="select * from"
			+"(select a.ModuleMark,a.Information,c.realName,"
			+"c.userMobile,c.ModuleMobile,b.Statue,c.carId,"
			+"c.regitTime,e.name province,f.name city,d.name county,ROW_NUMBER() OVER(Order by a.ModuleMark DESC) rs "
			+"from GPRSInfoList a,Statues b,userInfo c,D_county d,D_province e,D_city f where "
			+"a.ModuleMark  =b.ModuleMark and a.ModuleMark=c.ModuleMark "
			+"and  c.countyId=d.id and d.cityId=f.id and f.provinId"
			+"=e.id and c.ModuleMark=? )r where r.rs  BETWEEN ? and ?";
		
try {
			
			conn = BaseDao.getConnection();
			ps = conn.prepareStatement(sql);
			ps.setString(1, ModuleMark);
			ps.setInt(2, +((pageInt - 1) * rowsInt + 1));
			ps.setInt(3, pageInt * rowsInt);
			rs = ps.executeQuery();
			
			while (rs.next()) {
		
				GPSInfoVo Info=new GPSInfoVo();
				Info.setModuleMark(rs.getString("ModuleMark").trim());
				String Information=rs.getString("Information").trim();
				String Infor[]=Information.split(",");
				Info.setUTCTime(TimeChange(Infor[1]));
				Info.setLatitude(LatitudeChange(Infor[2]));
				Info.setLatitudeHemisphere(Infor[3]);
				Info.setLongitude(LongitudeChange(Infor[4]));
				Info.setLongitudeHemisphere(Infor[5]);
				Info.setGPSStatue(Infor[6]);
				Info.setSatellite_Number(Infor[7]);
				Info.setStatus(rs.getString("Statue"));
				Info.setCounty(rs.getString("province").trim()+rs.getString("city").trim()+rs.getString("county").trim());
				Info.setRealName(rs.getString("realName").trim());
				Info.setModulePhone(rs.getString("ModuleMobile").trim());
				Info.setUserPhone(rs.getString("userMobile").trim());
				Info.setRegitTime(rs.getString("regitTime").trim());
				Info.setCarId(rs.getString("carId").trim());
				list.add(Info);
			}
		}

		
		catch (Exception e) {
			e.printStackTrace();
		}

		
		finally {
			BaseDao.closeAll(rs, ps, conn);
		}
				
		return list;
	}
	
	

	
	public String getGPSInfoDetailListTotal(String ModuleMark)
	{
		/*
		 * select * from(
select *,ROW_NUMBER() OVER(Order by city DESC) rs  from mailCode) b
where b.rs BETWEEN 1 and 5
		 * 
		 * */
		String number="0";
		String sql=null;
		sql="select count(*) number "
			+"from GPRSInfoList,Statues,userInfo,D_county,D_province,D_city where "
			+"GPRSInfoList.ModuleMark  =Statues.ModuleMark and GPRSInfoList.ModuleMark=userInfo.ModuleMark "
			+"and  userInfo.countyId=D_county.id and D_county.cityId=D_city.id and D_city.provinId "
			+"=D_province.id and GPRSInfoList.ModuleMark=?";	
try {
			
			conn = BaseDao.getConnection();
			ps = conn.prepareStatement(sql);
			ps.setString(1, ModuleMark);
			rs = ps.executeQuery();
			
			while (rs.next()) 
				number=rs.getString("number");
				
		}

		
		catch (Exception e) {
			e.printStackTrace();
		}

		
		finally {
			BaseDao.closeAll(rs, ps, conn);
		}
				
		return number;
	}	
	public String getCarNumber()
	{
		String number="0";
		String sql=null;
		sql="select count(*) number from userInfo";	
try {
			
			conn = BaseDao.getConnection();
			ps = conn.prepareStatement(sql);
			rs = ps.executeQuery();
			
			while (rs.next()) 
				number=rs.getString("number");
				
		}

		
		catch (Exception e) {
			e.printStackTrace();
		}

		
		finally {
			BaseDao.closeAll(rs, ps, conn);
		}
				
		return number;
	}
	
	public GPSInfoVo getGPSInfo(String carId)
	{
		GPSInfoVo Info=new GPSInfoVo();
		String sql=null;
		sql="select a.ModuleMark,a.Information "
			+"from GPRSInfo a,Statues b,userInfo c where "
			+"a.ModuleMark  =b.ModuleMark and a.ModuleMark=c.ModuleMark"
			+" and c.carId=?";	
try {
			
			conn = BaseDao.getConnection();
			ps = conn.prepareStatement(sql);
			ps.setString(1, carId);
			rs = ps.executeQuery();
			
			while (rs.next()) {		
				
				Info.setModuleMark(rs.getString("ModuleMark").trim());
				String Information=rs.getString("Information").trim();
				String Infor[]=Information.split(",");
				Info.setUTCTime(TimeChange(Infor[1]));
				Info.setLatitude(LatitudeChange(Infor[2]));
				Info.setLatitudeHemisphere(Infor[3]);
				Info.setLongitude(LongitudeChange(Infor[4]));
				Info.setLongitudeHemisphere(Infor[5]);
				Info.setGPSStatue(Infor[6]);
				Info.setSatellite_Number(Infor[7]);
				Info.setCarId(carId);
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}

		
		finally {
			BaseDao.closeAll(rs, ps, conn);
		}
				
		return Info;
	}
	
	
}

